#include "role.h"
#include "config.h"

role::role()
{
    //初始化加载角色图片资源
    m_role.load(ROLE_PATH);

    //初始化角色坐标，左上角是（0，0）
    m_X=0;
    m_Y=(GAME_HEIGHT-m_role.height())*0.5;

    //角色血量
    m_health=ROLE_HEALTH;

    //时间记录
    m_recorder=0;

    //受伤后无敌时间
    m_time=ROLE_TIME;

    //初始化角色边框
    m_Rect.setWidth(m_role.width());
    m_Rect.setHeight(m_role.height());
    m_Rect.moveTo(m_X,m_Y);
}

void role::setPosition(int x, int y)
{
    m_X=x;
    m_Y=y;
    m_Rect.moveTo(m_X,m_Y);
}
